package org.jeecg.modules.complain.service.impl;
import org.jeecg.modules.complain.entity.Complain;
import org.jeecg.modules.complain.entity.ComplainStatus;
import org.jeecg.modules.complain.mapper.ComplainMapper;
import org.jeecg.modules.complain.service.IComplainService;
import org.jeecg.modules.complain.vo.ComplainReport;
import org.jeecg.modules.system.entity.SysDepart;
import org.jeecg.modules.system.entity.SysPosition;
import org.jeecg.modules.system.entity.SysUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.List;

/**
 * @Description: 投诉管理
 * @Author: jeecg-boot
 * @Date:   2019-08-30
 * @Version: V1.0
 */
@Service
public class ComplainServiceImpl extends ServiceImpl<ComplainMapper, Complain> implements IComplainService {

    @Autowired
    private ComplainMapper complainMapper;

    @Override
    public List<SysPosition> listById(String projectId) {
        return complainMapper.listById(projectId);
    }

    @Override
    public List<Complain>  selectDetailByUser(String userId, Integer status) {
        return complainMapper.selectDetailByUser(userId,status);
    }

    @Override
    public List<SysUser> listPostion(String id) {
        return complainMapper.listPostion(id);
    }

    @Override
    public Integer updateStatus(ComplainStatus complainStatus) {
        return complainMapper.updateStatus(complainStatus);
    }

    @Override
    public SysDepart selectDepart(String userId) {
        return complainMapper.selectDepart(userId);
    }

    @Override
    public  String selectPosition(String userId) {
        return complainMapper.selectPosition(userId);
    }

    @Override
    public ComplainReport getComplainReport(String projectId) {
        int total = complainMapper.getTotalByProjectId(projectId);
        int completeNum = complainMapper.getCompleteByProjectId(projectId);
        ComplainReport complainReport = new ComplainReport();
        complainReport.setTotal(total);
        complainReport.setCompleteNum(completeNum);
        return complainReport;
    }

}
